package com.xucy.springboot.designmodel.structural.composite;

/**
 * @Author xucy
 * @Date 2019-07-19 13:53
 * @Description 课程，可以查看价格 可以查看名字
 **/

public class Course extends CourseComponent{

    private String name;

    private double price;

    public Course(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CourseComponent courseComponent) {
       return this.name;
    }

    @Override
    public double getPrice(CourseComponent courseComponent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println(name +"  "+price);
    }
}
